package cn.uestc.labhms.modules.hms.entity.Vo;

import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import java.util.List;
import java.util.Objects;

/**
 * @author mtz
 */
@Getter
@Setter
@ToString
public class TimeLineVo implements Comparable<TimeLineVo> {
    private String date;
    private List<String> content;

    @Override
    public int compareTo(TimeLineVo o) {
        DateTime date = DateUtil.parseDate(this.date);
        DateTime date1 = DateUtil.parseDate(o.getDate());
        return date.isBeforeOrEquals(date1) ? -1 : 1;
    }
    @Override
    public boolean equals(Object o) {
        if (o == this) {
            return true;
        }
        if (!(o instanceof TimeLineVo)) {
            return false;
        }
        TimeLineVo timeLine = (TimeLineVo) o;
        return Objects.equals(this.date, timeLine.getDate());
    }
    @Override
    public int hashCode() {
        return Objects.hash(date);
    }
}
